]> dgit.raspbian.org Git - ostree.git/commit
tests/bsdiff: add content_size guard boundary test
authorJoseph Marrero Corchado <jmarrero@redhat.com>
Wed, 15 Jul 2026 17:22:45 +0000 (13:22 -0400)
committerJoseph Marrero Corchado <jmarrero@redhat.com>
Wed, 15 Jul 2026 17:22:45 +0000 (13:22 -0400)
commit4c9a6675e4cc91d6f3541e3db982e049a6113b85
tree733b553ab87fdb118837b01ac378fc7b1b9caf63
parent88f35c5afb6f86c18e8f17d28259ac00336a5051
tests/bsdiff: add content_size guard boundary test

Add test_bspatch_content_size_guard to verify the integer truncation
guard added for RHEL-189207.  The test exercises the exact boundary
condition used in dispatch_bspatch():

  content_size > G_MAXSIZE || content_size > (guint64)G_MAXINT64

It validates that:
- Values with bit 63 set and G_MAXUINT64 are always rejected
- On 32-bit systems, values above G_MAXUINT32 (4 GiB) are rejected
  including the PoC value 0x100001000 (4 GiB + 4 KiB)
- Normal values (0, 1, 4096, 1 GiB) are accepted and the casts to
  gsize and int64_t produce correct values
tests/test-bsdiff.c